home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / zfcid.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.6 KB  |  81 lines

  1. /* Copyright (C) 1996, 1997, 1998, 1999, 2000 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: zfcid.c,v 1.10.2.1 2000/11/09 23:04:44 rayjj Exp $ */
  20. /* CID-keyed font utilities */
  21. #include "ghost.h"
  22. #include "oper.h"
  23. #include "gsmatrix.h"
  24. #include "gxfcid.h"
  25. #include "bfont.h"
  26. #include "icid.h"
  27. #include "idict.h"
  28. #include "idparam.h"
  29. #include "ifcid.h"
  30. #include "store.h"
  31.  
  32. /* Get the CIDSystemInfo of a CIDFont. */
  33. int
  34. cid_font_system_info_param(gs_cid_system_info_t *pcidsi, const ref *prfont)
  35. {
  36.     ref *prcidsi;
  37.  
  38.     if (dict_find_string(prfont, "CIDSystemInfo", &prcidsi) <= 0)
  39.     return_error(e_rangecheck);
  40.     return cid_system_info_param(pcidsi, prcidsi);
  41. }
  42.  
  43. /* Get the additional information for a CIDFontType 0 or 2 CIDFont. */
  44. int
  45. cid_font_data_param(os_ptr op, gs_font_cid_data *pdata, ref *pGlyphDirectory)
  46. {
  47.     int code;
  48.     ref *pgdir;
  49.  
  50.     check_type(*op, t_dictionary);
  51.     if ((code = cid_font_system_info_param(&pdata->CIDSystemInfo, op)) < 0 ||
  52.     (code = dict_int_param(op, "CIDCount", 0, max_int, -1,
  53.                    &pdata->CIDCount)) < 0
  54.     )
  55.     return code;
  56.     /*
  57.      * If the font doesn't have a GlyphDirectory, GDBytes is required.
  58.      * If it does have a GlyphDirectory, GDBytes may still be needed for
  59.      * CIDMap: it's up to the client to check this.
  60.      */
  61.     if (dict_find_string(op, "GlyphDirectory", &pgdir) <= 0) {
  62.     /* Standard CIDFont, require GDBytes. */
  63.     make_null(pGlyphDirectory);
  64.     return dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 0,
  65.                   &pdata->GDBytes);
  66.     }
  67.     if (r_has_type(pgdir, t_dictionary) || r_is_array(pgdir)) {
  68.     /* GlyphDirectory, GDBytes is optional. */
  69.     *pGlyphDirectory = *pgdir;
  70.     code = dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 1,
  71.                   &pdata->GDBytes);
  72.     if (code == 1) {
  73.         pdata->GDBytes = 0;
  74.         code = 0;
  75.     }
  76.     return code;
  77.     } else {
  78.     return_error(e_typecheck);
  79.     }
  80. }
  81.